using System;
using System.Collections.Generic;
using System.Text;

namespace ScannerLib.Tsai
{
    public class CalibrationLine
    {
        private List<CalibrationPoint> m_points = new List<CalibrationPoint>();
        
        public CalibrationLine()
        {
            m_points = new List<CalibrationPoint>();
        }

        
        
        public void Add(CalibrationPoint cp)
        {
            int i=0;
            for (i = 0; i < m_points.Count; i++)
            {
                if (Math.Abs(cp.PY - m_points[i].PY) < 2)
                {
                    if (m_points[i].PX > cp.PX)
                        break;
                }
                else
                {
                    if (m_points[i].PY < cp.PY)
                        break;
                }
            }

            m_points.Insert(i, cp);
        }

        public void Remove(CalibrationPoint cp)
        {
            m_points.Remove(cp);
        }

        public void Clear()
        {
            m_points.Clear();
        }

        public void RemoveAt(int i)
        {
            m_points.RemoveAt(i);
        }
    }
}
